package com.mr.dao.entity.product;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.mr.constants.Tables;
import com.mr.dao.entity.BaseEntity;

/**
 * @author Alex
 */
@Entity(name = Tables.PRODUCT)
public class Product extends BaseEntity {
	private static final long serialVersionUID = -3440391630433143772L;
	private String prod_sku;
	private int quantity;
	private String filename;
	private String name;
	@Column
	@Lob
	private String description;
	private Calendar last_update;
	@ManyToOne
	private Category category;
	@ManyToOne
	private Warehouse warehouse;
	@OneToMany(mappedBy = "product", cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER)
	private List<Subproduct> subproducts = new ArrayList<Subproduct>(0);

	public String getProd_sku() {
		return prod_sku;
	}

	public void setProd_sku(String prod_sku) {
		this.prod_sku = prod_sku;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Calendar getLast_update() {
		return last_update;
	}

	public void setLast_update(Calendar last_update) {
		this.last_update = last_update;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public Warehouse getWarehouse() {
		return warehouse;
	}

	public void setWarehouse(Warehouse warehouse) {
		this.warehouse = warehouse;
	}

	public List<Subproduct> getSubproducts() {
		return subproducts;
	}

	public void setSubproducts(List<Subproduct> subproducts) {
		this.subproducts = subproducts;
	}

}
